import request from '@/server/request';

/** 获取数据源管理table数据
 *
 *
 * @export
 * @param {
 * pageIndex,
 * pageSize,
 * datasourceName,
 * datasourceGroup
 * } data
 * @return Promise
 */
export function getDataByPage(data) {
  return request({
    url: 'jobDatasource/queryByPage',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

/**  创建数据源配置
 * @export
 * @param {
 * comments,  //非必须
 * datasourceGroup, //非必须
 * datasource,
 * datasourceName,
 * jdbcDriverClass,
 * jdbcPassword,
 * jdbcUrl,
 * jdbcUsername,
 * } data
 * @return Promise
 */
export function jobDatasourceCreate(data) {
  return request({
    url: 'jobDatasource/create',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

// 测试连接数据源参数同 jobDatasourceCreate
export function jobDatasourceTest(data) {
  return request({
    url: 'jobDatasource/test',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

// 删除数据源配置
export function jobDatasourceDelete(data) {
  return request({
    url: 'jobDatasource/delete',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

// 修改数据源配置
export function jobDatasourceUpdate(data) {
  return request({
    url: 'jobDatasource/update',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

// 根据id查询数据源配置
/**
 *
 *
 * @export
 * @param {id} data
 * @return {*}
 */
export function jobDatasourceQueryById(data) {
  return request({
    url: 'jobDatasource/queryById',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}
